<template>
	<view>
		<scroll-view scroll-x class="bg-white nav fixed">
			<view class="flex text-center">
				<view class="cu-item flex-sub" :class="index==TabCur?'text-blue cur':''" v-for="(item,index) in list" :key="index"
				 @tap="tabSelect" :data-id="index">
					{{item}}
				</view>
			</view>
		</scroll-view>
		<block v-if="TabCur==0">
			<view style="margin-top: 90rpx;">
				<view class="indextit">说明：若访客信息较多，可选择导入excel模板。</view>
				<view class="template-wrapper">
					<view class="btns">
						<button class="btn1" data-clipboard-action="copy" data-clipboard-text="https://bwclf.ustc.edu.cn/word/车辆入校模板.xlsx" type="default" size="mini">
							<svg t="1681471403664" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2685" width="32" height="32"><path d="M544.256 605.184l244.224-244.224a31.744 31.744 0 0 1 45.056 45.056l-295.424 295.424a36.864 36.864 0 0 1-51.2 0L190.464 406.528a31.744 31.744 0 1 1 45.056-45.056l244.224 244.224V111.104a32.256 32.256 0 1 1 64 0zM153.6 902.656a32.256 32.256 0 0 1 0-64h716.8a32.256 32.256 0 0 1 0 64z" fill="#ffffff" p-id="2686"></path></svg>
							下载excel模板
						</button>
						<button type="default" size="mini" @click="uploadCarExcel">
							<svg t="1681471471003" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3844" width="32" height="32"><path d="M153.6 902.656a32.256 32.256 0 0 1 0-64h716.8a32.256 32.256 0 0 1 0 64z m390.656-665.6v494.592a32.256 32.256 0 0 1-64 0V237.056L236.032 481.28a31.744 31.744 0 1 1-45.056-45.056l294.912-295.424a36.864 36.864 0 0 1 51.2 0l294.912 294.912a31.744 31.744 0 0 1-45.056 45.056z" fill="#ffffff" p-id="3845"></path></svg>
							上传excel模板
						</button>
					</view>
					<view class="temp-tip">
						<view>操作步骤:</view>
						<view class="line">步骤一：点击下载excel模板按钮，自动复制链接；</view>
						<view class="line">步骤二：打开浏览器粘贴访问，下载excel模板；</view>
						<view class="line">步骤三：填完保存后，点击导入excel模板按钮 ，导入表格，系统自动填充访客信息。</view>
					</view>
				</view>
				<form>
					<view class="indextit">车辆信息及人员信息</view>
					<view v-for="(num,index) in form.carInfo" :key="index" style="border-top:1rpx solid #eee">
						<view class="cu-form-group" style="marginTop:10rpx;">
							<view class="title"><text class="text-red">*</text>来访人</view>
							<input placeholder="请输入校外拟入校人员姓名"  @click="disableInput=false" name="input" v-model="num.userName" @blur="getHistory($event,index)"></input>
							<text class="cuIcon-delete text-red" @click.stop="delCar(index)" v-if="form.carInfo.length>1"></text>
						</view>
						<!-- <view class="bordre-top">
							<view class="cu-form-group" style="display: block; width: 100%;min-height: 36px !important">
								<view class="title" style="display: block; width: 100%;"><text class="text-red">*</text>来访人安康码<text style="color: #8b8b8b;margin-left: 24px;">请上传来访人安康码</text></view>
							</view>
							<uni-file-picker 
								class="img-picker"
								:limit="1"
								v-model="num.akCode"
								:imageStyles="imageStyle"
								@select="uploadImg($event, num, 'akCode')"
							/>
						</view>
						<view class="bordre-top">
							<view class="cu-form-group" style="display: block; width: 100%;">
								<view class="title" style="display: block; width: 100%;"><text class="text-red">*</text>来访人行程码<text style="color: #8b8b8b;margin-left: 20px;">请上传来访人行程码且需与来访人联系电话保持一致</text></view>
							</view>
							<uni-file-picker 
								class="img-picker"
								:limit="1"
								v-model="num.tripCode"
								:imageStyles="imageStyle"
								@select="uploadImg($event, num, 'tripCode')"
							/>
						</view> -->
						<view class=" bordre-top" >
							<!-- <view class="cu-form-group">
								<view class="title"><text class="text-red">*</text>来访人出发地</view>
								<input placeholder="请选择出发地" name="input" v-model="num.applyArea" @tap="showPicker('region',index)"></input>
								<view class="can-click" @click="checkStartPlace(index)">点击核验</view>
							</view> -->
					<!-- 		<view style="background-color: #fff;margin-top: -40rpx;padding: 20rpx;">
								<view style="margin-left: 20rpx;color: crimson;">
									<view v-if="Array.isArray(num.areaInfo) && num.areaInfo.length===0" style="margin-left: 20rpx;color: crimson;">不在《疫情风险地区提示单》中的城市，需安康码、行程码（均绿码）并持48小时内核酸检测阴性证明入校。</view>
									<view v-else style="margin-left: 20rpx;">
										<text style="color: crimson;" v-for="(item2, index2) in num.areaInfo" :key="index2">
											<text style="font-weight: bold;">{{item2.title}}</br></text>{{item2.content}}</br>
										</text>
										<text v-if="num.areaInfo" class="can-click" @click="num.areaInfo=undefined">关闭</text>
									</view>
								</view>	
							</view> -->
						</view>
						<!-- <view class="cu-form-group bordre-top" style="display: block;width: 100%;">
							<view class="title" style="width: 100%;height: auto;"><text class="text-red">*</text>7天内到达或途径地 <text style="color:crimson;white-space: normal;">（若来访人7天内途径多个地点，请务必完整填写）</text></view>
							<view v-for="(item,index1) in num.passPlaceName" :key="index1">
								<view style="margin-left: 20rpx;display: flex;align-items: center;margin-bottom: 10rpx;">
									<view>{{item.name}}</view>
									<view class="can-click" @click="checkArea(item,num.passPlace[index1])">点击核验</view>
									<image @click="removeArea(num, index)" style="width: 36rpx;height: 36rpx;margin-left: 20rpx;" src="../../static/close.png" mode="widthFix"></image>
								</view>
								<view v-if="Array.isArray(item.content) && item.content.length===0" style="margin-left: 20rpx;color: crimson;">不在《疫情风险地区提示单》中的城市，需安康码、行程码（均绿码）并持48小时内核酸检测阴性证明入校。</view>
								<view v-else style="margin-left: 20rpx;color: crimson;">
									<text style="color: crimson;" v-for="(item2, index2) in item.content" :key="index2">
										<text style="font-weight: bold;">{{item2.title}}</text> </br>{{item2.content}}</br>
									</text>
									<text v-if="item.content" class="can-click" @click="item.content=undefined">关闭</text>
								</view>
							</view>
							<input style="margin-left: 20rpx;height:60rpx;" @tap="showPicker('region2',index)" placeholder="请选择7天内到达或途径地" name="input"></input>
						</view> -->
						<!-- <view class="bordre-top">
							<view class="cu-form-group" style="display: block; width: 100%;">
								<view class="title" style="display: block; width: 100%;">来访人核酸检测报告<text style="color: gray;margin-left: 10px;">选填项</text></view>
							</view>
							<uni-file-picker 
								class="img-picker"
								:limit="5"
								v-model="num.naCode"
								:imageStyles="imageStyle"
								@select="uploadImg($event, num, 'naCode')"
							/>
						</view> -->
						
			<!-- 			<view class="cu-form-group" >
							<view class="title" style="height: auto;margin: 12rpx 0;"><text class="text-red">*</text>是否有48小时核酸检测报告</view>
							<radio-group style="flex: 1;" @change="handleDangerRadio($event,index)">
								<label>
									<radio value="1" :checked="num.isDanger==1" /><text style="margin-left: 6rpx;">是</text>
								</label>
								<label style="margin-left: 60rpx;">
									<radio value="0" :checked="num.isDanger==0" /><text style="margin-left: 6rpx;">否</text>
								</label>
							</radio-group>
						</view> -->
						<view class="cu-form-group">
							<view class="title"><text class="text-red">*</text>联系电话</view>
							<input placeholder="请输入联系电话" name="input" v-model="num.userPhone" type="number"></input>
						</view>
						<view class="cu-form-group" @click.prevent="carInputClick(index)">
							<view class="title"><text class="text-red">*</text>车辆号码</view>
							<view class="carnumber">{{num.carNumber}}
								<!-- <image :src="energy" mode="" v-show="num.carNumber!=='请输入车牌号'&& num.carNumber.length>7"/> -->
							</view>
						</view>
						<view class="cu-form-group">
							<view class="title"><text class="text-red">*</text>车型选择</view>
							<picker @change="CarModelChange" @cancel="clear" :value="carIndex" :range="CarModelList" range-key="name"
							 :data-id="index" v-if="CarModelList.length">
								<view class="picker">
									{{num.carModelName}}
								</view>
							</picker>
						</view>
						<!-- <view class="cu-form-group">
							<view class="title">车辆品牌</view>
							<input placeholder="请输入车辆品牌" name="input" v-model="num.cabrand"></input>
						</view> -->
					</view>
					<view class="text-blue btn-add" @click="addCar">
						<text class="cuIcon-add"></text>
						<text>添加车辆</text>
					</view>
					<view class="indextit"></view>
					<view class="cu-form-group" @tap="showPicker('linkage')">
						<view class="title"><text class="text-red">*</text>校内接待部门</view>
						<input placeholder="请选择接待部门名称" name="input" v-model="form.departName"></input>
					</view>
					<view class="cu-form-group" @tap="showPicker('auditPerson')">
						<view class="title"><text class="text-red">*</text>审核人员</view>
						<input placeholder="请选择审核人员" name="input" v-model="form.checkUserName"></input>
					</view>
					<view class="cu-form-group">
						<view class="title"><text class="text-red">*</text>校内联系人</view>
						<input placeholder="请输入校内联系人姓名" disabled name="input" v-model="form.concatName"></input>
					</view>
					<view class="cu-form-group">
						<view class="title" style="height: auto;margin: 12rpx 0;">
							<text class="text-red">*</text>
							<text>
								<text style="display: inline-block;">校内联系人</text>
								<text style="display: inline-block;">GID号</text>
							</text>
						</view>
						<input disabled="" name="input" v-model="form.concatGid"></input>
					</view>
					<view class="cu-form-group">
						<view class="title" style="height: auto;margin: 12rpx 0;">
							<text class="text-red">*</text>
							<text>
								<text style="display: inline-block;">校内联系人</text>
								<text style="display: inline-block;">工资号</text>
							</text>
						</view>
						<input disabled="" name="input" v-model="form.concatWage"></input>
					</view>
					<view class="cu-form-group">
						<view class="title"><text class="text-red">*</text>联系电话</view>
						<input placeholder="请输入校内联系人电话" name="input" v-model="form.concatPhone" type="number"></input>
					</view>
					<view class="cu-form-group" @tap.stop="PickerSchool" style="marginTop:15rpx;">
						<view class="title"><text class="text-red">*</text>校区</view>
						<input placeholder="请选择校区" name="input" v-model="form.campus"></input>
					</view>
					<!-- <view class="cu-form-group">
						<view class="title">大门</view>
						<input placeholder="请输入入校大门" name="input" v-model="form.campusDoor"></input>
					</view> -->
					<view class="cu-form-group" @tap="showPicker('range')">
						<view class="title"><text class="text-red">*</text>入校日期</view>
						<input placeholder="请选择日期区间" name="input" v-model="formDateRange"></input>
					</view>
					<view class="cu-form-group">
						<view class="title">入校时间</view>
						<picker @change="bindPickerNum" :value="index" :range="numArr" range-key="value">
							<view class="picker" v-if="form.enrolledDateTime==='请输入具体时间'">
								请输入具体时间
							</view>
							<view class="picker" v-else>
								{{numArr[index].value}}
							</view>
						</picker>
					</view>
					<view class="indextit"><text class="text-red">*</text>入校原因</view>
					<view class="cu-form-group align-start">
						<textarea maxlength="-1" @input="textareaBInput" placeholder="请输入入校原因" v-model="form.enrolledReason"></textarea>
					</view>
				</form>
				<view class="padding flex flex-direction">
					<button class="cu-btn bg-blue lg" @click="submitusercarapply" :disabled="loadModal">提交申请</button>
				</view>
			</view>
		</block>
		<block v-if="TabCur==1">
			<view style="margin-top: 90rpx;">
				<view class="indextit">说明：若访客信息较多，可选择导入excel模板。</view>
				<view class="template-wrapper">
					<view class="btns">
						<button class="btn1" data-clipboard-action="copy" data-clipboard-text="https://bwclf.ustc.edu.cn/word/人员入校模板.xlsx" type="default" size="mini">
							<svg t="1681471403664" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2685" width="32" height="32"><path d="M544.256 605.184l244.224-244.224a31.744 31.744 0 0 1 45.056 45.056l-295.424 295.424a36.864 36.864 0 0 1-51.2 0L190.464 406.528a31.744 31.744 0 1 1 45.056-45.056l244.224 244.224V111.104a32.256 32.256 0 1 1 64 0zM153.6 902.656a32.256 32.256 0 0 1 0-64h716.8a32.256 32.256 0 0 1 0 64z" fill="#ffffff" p-id="2686"></path></svg>
							下载excel模板
						</button>
						<button type="default" size="mini" @click="uploadUserExcel">
							<svg t="1681471471003" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3844" width="32" height="32"><path d="M153.6 902.656a32.256 32.256 0 0 1 0-64h716.8a32.256 32.256 0 0 1 0 64z m390.656-665.6v494.592a32.256 32.256 0 0 1-64 0V237.056L236.032 481.28a31.744 31.744 0 1 1-45.056-45.056l294.912-295.424a36.864 36.864 0 0 1 51.2 0l294.912 294.912a31.744 31.744 0 0 1-45.056 45.056z" fill="#ffffff" p-id="3845"></path></svg>
							上传excel模板
						</button>
					</view>
					<view class="temp-tip">
						<view>操作步骤:</view>
						<view class="line">步骤一：点击下载excel模板按钮，自动复制链接；</view>
						<view class="line">步骤二：打开浏览器粘贴访问，下载excel模板；</view>
						<view class="line">步骤三：填完保存后，点击导入excel模板按钮 ，导入表格，系统自动填充访客信息。</view>
					</view>
				</view>
				<form>
					<view class="indextit">人员信息</view>
					<view v-for="(num,index) in userForm.userInfo" :key="index">
						<view class="cu-form-group" style="marginTop:10rpx;">
							<view class="title"  @click="chooseImg"><text class="text-red">*</text>来访人</view>
							<input placeholder="请输入校外拟入校人员姓名" @click="disableInput=false" name="input" v-model="num.userName" @blur='getUserHistory($event,index)'></input>
							<text class='cuIcon-delete text-red' @click="delUser(index)" v-if="userForm.userInfo.length>1"></text>
						</view>
						<!-- <view class="bordre-top">
							<view class="cu-form-group"  style="display: block; width: 100%; min-height: 36px !important"  >
								<view class="title"  style="display: block; width: 100%;"><text class="text-red" >*</text>来访人安康码<text style="color: #8b8b8b;margin-left: 24px;">请上传来访人安康码</text></view>
							</view>
							<uni-file-picker  
								:limit="1"
								class="img-picker"
								v-model="num.akCode"
								:imageStyles="imageStyle"
								@select="uploadImg($event, num, 'akCode')"
							/>
						</view> -->
						<!-- <view class="bordre-top">
							<view class="cu-form-group"  style="display: block; width: 100%;">
								<view class="title"  style="display: block; width: 100%;"><text class="text-red">*</text>来访人行程码<text style="color: #8b8b8b;margin-left: 20px;">请上传来访人行程码且需与来访人联系电话保持一致</text></view>
							</view>
							<uni-file-picker 
								:limit="1"
								class="img-picker"
								v-model="num.tripCode"
								:imageStyles="imageStyle"
								@select="uploadImg($event, num, 'tripCode')"
							/>
						</view> -->
						<view class="bordre-top">
							<!-- <view class="cu-form-group" >
								<view class="title"><text class="text-red">*</text>来访人出发地</view>
								<input name="input" placeholder="请选择出发地" v-model="num.applyArea" @tap="showPicker('region',index)"></input>
								<view class="can-click" @click="checkStartPlace(index)">点击核验</view>
							</view> -->
					<!-- 		<view style="background-color: #fff;margin-top: -40rpx;padding: 20rpx;">
								<view style="margin-left: 20rpx;color: crimson;">
									<view v-if="Array.isArray(num.areaInfo) && num.areaInfo.length===0" style="margin-left: 20rpx;color: crimson;">不在《疫情风险地区提示单》中的城市，需安康码、行程码（均绿码）并持48小时内核酸检测阴性证明入校。</view>
									<view v-else style="margin-left: 20rpx;color: crimson;">
										<text style="color: crimson;" v-for="(item2, index2) in num.areaInfo" :key="index2">
											<text style="font-weight: bold;">{{item2.title}}</text> </br>{{item2.content}}</br>
										</text>
										<text v-if="num.areaInfo" class="can-click" @click="num.areaInfo=undefined">关闭</text>
									</view>
								</view>	
							</view> -->
						</view>
						<!-- <view class="cu-form-group bordre-top" style="display: block;">
							<view class="title" style="width: 100%;height: auto;margin-bottom: 10rpx;"><text class="text-red">*</text>7天内到达或途径地<text style="color:crimson;white-space: normal;">（若来访人7天内途径多个地点，请务必完整填写）</text></view>
							<view v-for="(item,index1) in num.passPlaceName" :key="index1">
								<view style="margin-left: 20rpx;display: flex;align-items: center;margin-bottom: 10rpx;">
									<view>{{item.name}}</view>
									<view class="can-click" @click="checkArea(item,num.passPlace[index1])">点击核验</view>
									<image @click="removeArea(num, index)" style="width: 36rpx;height: 36rpx;margin-left: 20rpx;" src="../../static/close.png" mode="widthFix"></image>
								</view>
								<view v-if="Array.isArray(item.content) && item.content.length===0" style="margin-left: 20rpx;color: crimson;">不在《疫情风险地区提示单》中的城市，需安康码、行程码（均绿码）并持48小时内核酸检测阴性证明入校。</view>
								<view v-else style="margin-left: 20rpx;">
									<text style="color: crimson;" v-for="(item2, index2) in item.content" :key="index2">
										<text style="font-weight: bold;">{{item2.title}}</br></text>{{item2.content}}</br>
									</text>
									<text v-if="item.content" class="can-click" @click="item.content=undefined">关闭</text>
								</view>
							</view>
							<input style="margin-left: 20rpx;height:60rpx;" @tap="showPicker('region2',index)" placeholder="请选择7天内到达或途径地" name="input"></input>
						</view> -->
						<!-- <view class="bordre-top">
							<view class="cu-form-group" style="display: block; width: 100%;">
								<view class="title" style="display: block; width: 100%;">来访人核酸检测报告<text style="color: gray;margin-left: 10px;">选填项</text></view>
							</view>
							<uni-file-picker 
								:limit="5"
								class="img-picker"
								v-model="num.naCode"
								:imageStyles="imageStyle"
								@select="uploadImg($event, num, 'naCode')"
							/>
						</view> -->
	<!-- 					<view class="cu-form-group bordre-top">
							<view class="title" style="height: auto !important;margin: 12rpx 0;"><text class="text-red">*</text>是否有48小时核酸检测报告</view>
							<radio-group style="flex: 1;"  @change="handleDangerRadio2($event,index)">
								<label>
									<radio value="1" :checked="num.isDanger==1" /><text style="margin-left: 6rpx;">是</text>
								</label>
								<label style="margin-left: 60rpx;">
									<radio value="0" :checked="num.isDanger==0" /><text style="margin-left: 6rpx;">否</text>
								</label>
							</radio-group>
						</view> -->
						<view class="cu-form-group">
							<view class="title"><text class="text-red">*</text>证件类型</view>
							<picker @change="bindType" @cancel="clear" :value="typeindex" :range="carType" range-key="name" :data-id="index">
								<view class="picker">
									{{num.carTypeName}}
								</view>
							</picker>
						</view>
						<view class="cu-form-group">
							<view class="title"><text class="text-red">*</text>证件号码</view>
							<input placeholder="请输入证件号码" name="input" v-model="num.cardNo"></input>
						</view>
						<view class="cu-form-group">
							<view class="title"><text class="text-red">*</text>联系电话</view>
							<input placeholder="请输入联系电话" name="input" v-model="num.userPhone"></input>
						</view>
					</view>
					<view class="text-blue btn-add" @click="addUser">
						<text class="cuIcon-add"></text>
						<text>添加人员</text>
					</view>
					<view class="cu-form-group" style="marginTop:15rpx;"  @tap="showPicker('linkage',-1,'userForm')">
						<view class="title"><text class="text-red">*</text>校内接待部门</view>
						<input placeholder="请选择接待部门名称" name="input" v-model="userForm.departName"></input>
					</view>
					<view class="cu-form-group" @tap="showPicker('auditPerson', -1, 'userForm')">
						<view class="title"><text class="text-red">*</text>审核人员</view>
						<input placeholder="请选择审核人员" name="input" v-model="userForm.checkUserName"></input>
					</view>
					<view class="cu-form-group">
						<view class="title"><text class="text-red">*</text>校内联系人</view>
						<input placeholder="请输入校内联系人" disabled name="input" v-model="userForm.concatName"></input>
					</view>
					<view class="cu-form-group">
						<view class="title" style="height: auto;margin: 12rpx 0;">
							<text class="text-red">*</text>
							<text>
								<text style="display: inline-block;">校内联系人</text>
								<text style="display: inline-block;">GID号</text>
							</text>
						</view>
						<input disabled="" name="input" v-model="userForm.concatGid"></input>
					</view>
					<view class="cu-form-group">
						<view class="title" style="height: auto;margin: 12rpx 0;">
							<text class="text-red">*</text>
							<text>
								<text style="display: inline-block;">校内联系人</text>
								<text style="display: inline-block;">工资号</text>
							</text>
						</view>
						<input disabled="" name="input" v-model="userForm.concatWage"></input>
					</view>
					<view class="cu-form-group">
						<view class="title"><text class="text-red">*</text>联系电话</view>
						<input placeholder="请输入校内联系人电话" name="input" v-model="userForm.concatPhone"></input>
					</view>
					<view class="cu-form-group" @tap.stop="PickerSchool('userForm')" style="marginTop:15rpx;">
						<view class="title"><text class="text-red">*</text>校区</view>
						<input placeholder="请选择校区" name="input" v-model="userForm.campus"></input>
					</view>
					<!-- <view class="cu-form-group">
						<view class="title">大门</view>
						<input placeholder="请输入入校大门" name="input" v-model="userForm.campusDoor"></input>
					</view> -->
					<view class="cu-form-group" @tap="showPicker('rangeuser')">
						<view class="title"><text class="text-red">*</text>入校日期</view>
						<input placeholder="请选择日期区间" name="input" v-model="userFormDateRange"></input>
					</view>
					<view class="cu-form-group">
						<view class="title">入校时间</view>
						<picker @change="bindPickerNumUser" :value="userIndex" :range="numArr" range-key="value">
							<view class="picker" v-if="userForm.enrolledDateTime==='请输入具体时间'">
								请输入具体时间
							</view>
							<view class="picker" v-else>
								{{numArr[userIndex].value}}
							</view>
						</picker>
					</view>
					<view class="indextit"><text class="text-red">*</text>入校原因</view>
					<view class="cu-form-group align-start">
						<textarea maxlength="-1" @input="textareaBInputUser" placeholder="请输入入校原因" v-model="userForm.enrolledReason"></textarea>
					</view>
				</form>
				<view class="padding flex flex-direction">
					<button class="cu-btn bg-blue lg" @click="submituserinfoapply()" :disabled="loadModal">提交申请</button>
				</view>
			</view>
		</block>
		<block v-if="TabCur==2">
			<view style="margin-top: 90rpx;">
				<view class="cu-bar search bg-white">
					<view class="search-form round">
						<text class="cuIcon-search"></text>
						<input v-model="keyword" :adjust-position="false" type="text" placeholder="请输入来访人姓名进行查询" confirm-type="search"></input>
					</view>
					<view class="action">
						<button class="cu-btn bg-blue shadow-blur" @click="search">查询</button>
					</view>
				</view>
				<view class="bg-white padding-lr">
					<view class="padding-xs flex align-center" v-for="(value,index) in result" :key="index">
						<view class="flex-sub text-center" v-if="value!={}">
							<view class="solid-bottom text-xsl">
								<text class="cuIcon-roundclose text-red" v-if="value.applyStatus===0"></text>
								<text class="cuIcon-info text-orange" v-else-if="value.applyStatus===1"></text>
								<text class="cuIcon-roundcheck text-green" v-else-if="value.applyStatus===2"></text>
							</view>
							<view class="padding text-xl text-black">审核<text v-if="value.applyStatus===0">不通过</text><text v-else-if="value.applyStatus===1">中</text><text
								 v-else-if="value.applyStatus===2">通过</text></view>
							<view class="padding text-black" v-if="value.applyStatus===0">拒绝原因：<text class="text-red">{{value.banReason}}</text></view>
							<view class="text-left padding-bottom-xs">申请类型：<text v-if="!value.applyType">人员申请</text><text v-else>车辆申请</text></view>
							<!-- 12.24新增 top-->
							<view class="text-left padding-bottom-xs">校内接待部门：{{value.departName}}</view>
							<view class="text-left padding-bottom-xs">校内联系人：{{value.concatName}}</view>
							<view class="text-left padding-bottom-xs">校内联系人电话：{{value.concatPhone}}</view>
							<!-- 12.24新增 bottom -->
							<view class="text-left padding-bottom-xs" v-if="value.userDays">入校日期：{{value.userDays}}</view>
							<view class="text-left padding-bottom-xs" v-if="value.carDays">入校日期：{{value.carDays}}</view>
							<view v-if="value.applyType && value.lstCars" v-for="(item,index) in value.lstCars" :key="index">
								<view class="text-left padding-bottom-xs">来访人姓名：{{item.userName}}</view>
								<view class="text-left padding-bottom-xs">车牌号码：{{item.carNumber}}</view>
							</view>
							<view v-if="!value.applyType && value.lstUsers" v-for="(item,index) in value.lstUsers" :key="index">
								<view class="text-left padding-bottom-xs">来访人姓名：{{item.userName}}</view>
								<view class="text-left padding-bottom-xs">证件号码：{{item.cardNo}}</view>
							</view>
							<view v-if="value.applyStatus===1" class="text-left padding-bottom-xs">审核人员: {{value.checkUserName}}</view>
							<view v-if="value.progress" class="text-left padding-bottom-xs">审核进度：{{value.progress}}</view>
						</view>
					</view>
				</view>
				<!-- <view class="bg-white padding-lr" id="pass">
				<view class="padding-xs flex align-center">
					<view class="flex-sub text-center">
						<view class="solid-bottom text-xsl">
							<text class=" cuIcon-roundcheck text-green"></text>
						</view>
						<view class="padding text-xl text-black">审核通过</view>
						<view class="text-left">申请类型：人员申请</view>
						<view class="text-left">证件号码：身份证52334999999999999</view>
					</view>
				</view>
			</view> -->

			</view>
		</block>
		<!-- 引用车牌组件 -->
		<plate-number ref="plate" v-model="plateNum" @showOrHide="showOrHide" @input="input"></plate-number>
		<view class="cu-modal" :class="modal=='DialogModal1'?'show':''">
			<view class="cu-dialog">
				<view class="cu-bar bg-white justify-end">
					<view class="content">提示</view>
					<view class="action" @tap="hideModal">
						<text class="cuIcon-close text-black"></text>
					</view>
				</view>
				<view class="padding-xl">
					确定删除此车辆？
				</view>
				<view class="cu-bar bg-white justify-end">
					<view class="action">
						<button class="cu-btn line-gray text-green" @tap="cancel">取消</button>
						<button class="cu-btn bg-blue margin-left" @tap="del">确定</button>
					</view>
				</view>
			</view>
		</view>
		<view class="cu-modal" :class="modal=='DialogModal2'?'show':''">
			<view class="cu-dialog">
				<view class="cu-bar bg-white justify-end">
					<view class="content">提示</view>
					<view class="action" @tap="hideModal">
						<text class="cuIcon-close text-black"></text>
					</view>
				</view>
				<view class="padding-xl">
					确定删除此人员申请？
				</view>
				<view class="cu-bar bg-white justify-end">
					<view class="action">
						<button class="cu-btn line-gray text-green" @tap="cancelU">取消</button>
						<button class="cu-btn  bg-blue margin-left" @tap="delU">确定</button>
					</view>
				</view>
			</view>
		</view>
		<view class="cu-modal" :class="modal=='DialogModal3'?'show':''">
			<view class="cu-dialog">
				<view class="cu-bar bg-white justify-end">
					<view class="content">提示</view>
					<view class="action" @tap="hideModal">
						<text class="cuIcon-close text-black"></text>
					</view>
				</view>
				<view class="padding-xl">
					时间区域不能大于七天，请重新选择
				</view>
				<view class="cu-bar bg-white justify-end">
					<view class="action">
						<button class="cu-btn bg-blue" @tap="showPicker('rangeuser')">确定</button>
					</view>
				</view>
			</view>
		</view>
		<view class="cu-modal" :class="modal=='DialogModal4'?'show':''">
			<view class="cu-dialog">
				<view class="cu-bar bg-white justify-end">
					<view class="content">提示</view>
					<view class="action" @tap="hideModal">
						<text class="cuIcon-close text-black"></text>
					</view>
				</view>
				<view class="padding-xl">
					时间区域不能大于七天，请重新选择
				</view>
				<view class="cu-bar bg-white justify-end">
					<view class="action">
						<button class="cu-btn bg-blue" @tap="showPicker('range')">确定</button>
					</view>
				</view>
			</view>
		</view>
		<view class="cu-load loading loadingfixed text-blue round" :class="loadModal?'show':''"></view>
		<w-picker mode="range" startYear="2020" endYear="2030" :current="true" @confirm="onConfirmUser($event,'range')"
		 @cancel="onCancel" ref="rangeuser"></w-picker>
		<w-picker mode="range" startYear="2020" endYear="2030" :current="true" @confirm="onConfirm($event,'range')" @cancel="onCancel"
		 ref="range"></w-picker>
		<w-picker mode="linkage" :value="defaultRegion1" :options="options" :level="2" :default-props="defaultProps1"
		 @confirm="onConfirmLinkage($event,'linkage')" @cancel="onCancel" ref="linkage"></w-picker>
		<w-picker mode="selector" :value="defaultRegion1" :options="auditPersons" :default-props="defaultProps2"
		  @confirm="onConfirmAuditPerson($event,'auditPerson')" @cancel="onCancel" ref="auditPerson"></w-picker>
		<w-picker mode="region" :value="defaultRegion" default-type="value" :hide-area="false" @confirm="onConfirmRegion($event,'region')"
		 @cancel="onCancel" ref="region"></w-picker>
		 <w-picker mode="region" :value="defaultRegion" default-type="value" :hide-area="false" @confirm="onConfirmPassRegion($event,'region')"
		  @cancel="onCancel" ref="region2"></w-picker>
		<multiple-select v-model="show" :default-selected="defaultSelected" :data="xiaoqu" @confirm="confirmXiaoqu"></multiple-select>
		<view class="modal" v-if="showNotice">
			<view class="mask">	
			</view>
			<view class="container">
					<view class="title">申请须知</view>
                            <view class="content">
                                <view>1、确因工作需要进校的来访人员，按照“谁邀请、谁负责，谁主管、谁负责”的原则，由校内邀请人（联系人）通过本平台进行人员、车辆入校申请；</view>
                                <view>2、本平台仅限于教职工使用，实行分类审核。人员和车辆（轿车、中小型货车、中小型客车）由校内申请人所在单位审核通过后，审核流程结束，访客凭有效身份证件和短信（含二维码链接）刷码进校；大型客车、特种车辆及大型货车（大型货车、中小型工程车、大型工程车非工作日进校）仍将推送至保卫与校园管理处审核，访客凭有效身份证件和短信（含二维码链接）刷码进校。以上若为团体进校仍将推送至保卫与校园管理处审核；</view>
                                <view>3、特种车辆（包括但不限于叉车、吊车、铲车等）及大型货车（车长超过6m且总质量4500千克以上），原则上工作日不能进校；如有紧急情况，工作日入校需校内联络单位线下提交由单位主要负责人签字、盖章的纸质申请单（制式模板见官网《特种车辆及大型货车入校备案须知》）。进校时间应避开上下班（学）高峰期（7：30-8：30，13：50-14：20，17：30-18：20）；</view>
                                <view>4、若访客车辆、人员较多，可选择批量导入，详情见填写界面；</view>
                                <view>5、申请人所填访客信息、进校事由等必须真实准确，不得造假；</view>
                                <view>6、如遇学校重大活动，将视情况动态管理；</view>
                                <view>7、申请从事采访、拍摄、录制等活动人员进校，进校人员需随身携带校内申请单位发放的采访证或备案表（需备注校内联系人相关信息），以便联系；</view>
                                <view>8、来访人员、车辆进入校园，自觉遵守相关校园交通管理规定，车辆进校后必须按照校园交通标志行驶，按照泊位或指定位置停放，严禁占用主干道或随意停放车辆，不得鸣笛，车速不得超过20km/h，且驾驶员联系方式置于车辆前挡风玻璃处醒目位置；</view>
                                <view>9、如有其他疑问，详情请咨询保卫与校园管理处综合事务管理办公室0551-63600083。</view>
                            </view>
				<button :disabled="!canClick" :class="canClick && 'active'" type="default" @click="showNotice=false">已阅读{{ times>0 ? `(${times}s)`:''}}</button>
			</view>
		</view>
	</view>
</template>

<script>
	import multipleSelect from "@/components/multiple-select/multiple-select"
	import wPicker from "@/components/w-picker/w-picker.vue"
	import baseUrl from '../../api/api.js'
	import energy from './energy.png'
	import plateNumber from '@/components/plate-number/plateNumber.vue';
	import ClipboardJS from 'clipboard'


	let Base64 = require('js-base64').Base64
	export default {
		components: {
			plateNumber,
			wPicker,
			multipleSelect,
		},
		data() {
			return {
				imageStyle:{
					"height": 100,	// 边框高度
					"width": 100,	// 边框宽度
					"border":{ // 如果为 Boolean 值，可以控制边框显示与否
						"color":"#eee",		// 边框颜色
						"width":"1px",		// 边框宽度
						"style":"solid", 	// 边框样式
						"radius":"10" 		// 边框圆角，支持百分比
					}
				},
				imageValue: [],
				defaultProps1: {
					label: "departName",
					value: "deptId",
					children: "departList"
				},
				defaultProps2: {
					label: "checkUserName",
					value: "checkUserGid",
					// children: "departList"
				},
				defaultSelected: [],
				index: 0,
				defaultRegion1: [],
				options: [],
				show: false,
				defaultRegion: ["340000", "340100", "340104"],
				userFormDateRange: '年/月/日',
				formDateRange: '年/月/日',
				numArr: [{
						value: "0时"
					}, {
						value: "1时"
					}, {
						value: "2时"
					}, {
						value: "3时"
					}, {
						value: "4时"
					}, {
						value: "5时"
					}, {
						value: "6时"
					}, {
						value: "7时"
					}, {
						value: "8时"
					}, {
						value: "9时"
					}, {
						value: "10时"
					}, {
						value: "11时"
					}, {
						value: "12时"
					},
					{
						value: "13时"
					}, {
						value: "14时"
					}, {
						value: "15时"
					}, {
						value: "16时"
					}, {
						value: "17时"
					}, {
						value: "18时"
					}, {
						value: "19时"
					}, {
						value: "20时"
					}, {
						value: "21时"
					}, {
						value: "22时"
					}, {
						value: "23时"
					}
				],
				carIndex: 0,
				loadModal: false,
				modal: null,
				isSumbituser: false,
				isSumbituserInfo: false,
				form: {
					passPlaceName: [],
					checkUserName: '',
					checkUserGid: '',
					checkUserEmail: '',
					departName: '',
					concatName: '',
					concatPhone: '',
					carInfo: [{
						userName:'',
						areaInfo: '',
						applyArea:'',
						areaId:'',
						isDanger: 0,
						userPhone:'',
						carNumber: '请输入车牌号',
						carModel: '',
						carModelName: '请选择车型',
						cabrand: '',
						akCode:'',
						tripCode:'',
						naCode:'',
						passPlace: [],
						passPlaceName: [],
					}],
					campus: '',
					campusId: '',
					applyArea: '',
					areaId: '',
					deptId: '',
					campusDoor: '',
					enrolledDate: '',
					endTime: '',
					enrolledDateTime: '请输入具体时间',
					enrolledReason: '',
					concatGid: '',
					concatName: '',
					
				},
				userForm: {
					checkUserName: '',
					checkUserGid: '',
					checkUserEmail: '',
					userInfo: [{
						userName: '',
						userPhone: '',
						applyArea: '',
						areaId: '',
						carType: '',
						carTypeName: '请选择证件类型',
						cardNo: '',
						isDanger: 0,
						akCode:'',
						tripCode:'',
						naCode:'',
						passPlace: [],
						passPlaceName: [],
					}],
					departName: '',
					deptId: '',
					concatName: '',
					concatPhone: '',
					campus: '',
					campusId: '',
					campusDoor: '',
					enrolledDate: '',
					endTime: '',
					enrolledDateTime: '请输入具体时间',
					enrolledReason: '',
					concatGid: '',
					concatName: '',
				},
				modalName: null,
				campus: null,
				CarModelList: [{
					name: '请选择车型',
					code: ''
				}],
				xqindex: -1,
				PXQindex: -1,
				xiaoqu: [],
				typeindex: 0,
				carType: [{
					name: '请选择身份类型',
					code: ''
				}],
				TabCur: '1',
				list: ['车辆申请', '人员申请', '结果查询'],
				dialog: null,
				plateNum: '',
				keyword: '',
				result: [],
				numIndex: null,
				userIndex: 0,
				name: null,
				openId:null,
				ticket:null,
				energy: '', //新能源图标的地址
				canClick: false ,// 已阅读是否可以点击
				showNotice: false,
				times: process.env.NODE_ENV === 'production' ? 3 : 0,
				auditPersons: [],
				disableInput: false
			}
		},
		onShow() {
			this.energy = energy;
			// this.disableInput = false
		},
		mounted() {
			this.$nextTick(() => {
				this.clipboard = new ClipboardJS('.btn1');
				this.clipboard.on('success', (e) => {
					e.clearSelection();
					uni.showToast({
						title: '复制成功',
						icon: 'none'
					})
				});
			})
		},
		onLoad() {	
			
			uni.$on('chooseImg', () => {
				this.disableInput = true
			})
			if(this.getParam(location.href, "error")) {
				return uni.showModal({
					content: decodeURIComponent(Base64.decode(this.getParam(location.href, "error"))),
					showCancel: false,
					success: (res) => {
						if(res.confirm) {
							window.location.href = "https://passport.ustc.edu.cn/login";
						}
					}
				})
			}
			if(uni.getStorageSync('flag')) {
				uni.removeStorageSync('flag')
			} else {
				this.showNotice = true
				this.timer = setInterval(() =>{
					this.times--
					if(this.times<=0) {
						this.canClick = true
						clearInterval(this.timer)
					} 
				}, 1000) 
			}

			this.ticket = this.getParam(location.href, "ticket");
			this.openId = this.getParam(location.href, "openId"); 
			this.concatName = decodeURIComponent(Base64.decode(this.getParam(location.href, "concatName")))
			this.concatWage = decodeURIComponent(Base64.decode(this.getParam(location.href, "concatWage")))
			
			this.concatGid = Base64.decode(this.getParam(location.href, "concatGid"));
			this.form.concatName = this.concatName
			this.form.concatGid = this.concatGid
			this.form.concatWage = this.concatWage
			
			this.userForm.concatName = this.concatName
			this.userForm.concatGid = this.concatGid 
			this.userForm.concatWage = this.concatWage 
			this.getOPenid()
			return 
			if(this.ticket){
				// uni.setStorageSync('storage_keys', this.ticket);
				console.log(this.ticket)
				this.getOPenid()
			} else{
				// this.ticket = uni.getStorageSync('storage_keys');
				if(this.ticket){
					return 
					this.getOPenid()
				}else{

					window.location.href = "https://passport.ustc.edu.cn/login?service=http://bwclf.ustc.edu.cn/weixin/getOauthUrl";
				}
			}
		},
		methods: {
			uploadCarExcel() {
				uni.chooseFile({
				  count: 6, //默认100
				  extension:['.xlsx'],
					success:  (res) => {
						let tempFilePaths = res.tempFilePaths
						uni.uploadFile({
							url: baseUrl.baseUrl + "zkd/uploadExcel",
							filePath: tempFilePaths[0],
							name: 'file',
							formData: {
								'user': 'test'
							},
							success: (uploadFileRes) => {
								this.form.carInfo = JSON.parse(uploadFileRes.data).data
								console.log(this.form.carInfo );
							}
						});
					}
				});
			},
			uploadUserExcel() {
				uni.chooseFile({
				  count: 1, //默认100
				  extension:['.xlsx'],
					success:  (res) => {
						console.log(JSON.stringify(res.tempFilePaths));
						let tempFilePaths = res.tempFilePaths
						uni.uploadFile({
							url: baseUrl.baseUrl + "applicationUserRecord/uploadExcel",
							filePath: tempFilePaths[0],
							name: 'file',
							formData: {
								'user': 'test'
							},
							success: (uploadFileRes) => {
								this.userForm.userInfo= JSON.parse(uploadFileRes.data).data
								console.log(uploadFileRes.data);
							}
						});
					}
				});
			},
			async checkStartPlace(index) {
				if(this.TabCur==0) {
					let areaId = this.form.carInfo[index].areaId
					areaId = areaId.split(',')
					const res = await this.check(areaId[2] || areaId[1])
					this.form.carInfo[index].areaInfo = res.data.data
				} else {
					let areaId = this.userForm.userInfo[index].areaId
					areaId = areaId.split(',')
					const res = await this.check(areaId[2] || areaId[1])
					this.userForm.userInfo[index].areaInfo = res.data.data
				}
				this.$forceUpdate()
			},
			removeArea(item,index) {
				item.passPlace.splice(index,1)
				item.passPlaceName.splice(index,1)
			},
			async checkArea(item, areaId) {
				const res = await this.check(areaId)
				item.content = res.data.data
			},
			check(areaCode) {
				return new Promise((resolve, reject) => {
					uni.request({
						url: baseUrl.baseUrl + "applicationUserRecord/check",
						data: {
							areaCode: areaCode,
						},
						method: 'GET',
						header: {
							'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
						},
						success: (res) => {
							return resolve(res)
						}
					})
				})
			},
			async uploadImg(e,item,key) {
				let arr = []
				let tempFilePaths = e.tempFilePaths
				for (let path of tempFilePaths) {
					let res =  await this.upload(path) 
					arr.push(res.data)
				}
				if(Array.isArray(item[key])) {
					item[key] = [...item[key],...arr]
				} else {
					item[key] = arr
				}
				this.$forceUpdate()
			},
			upload(tempFilePath) {
				return new Promise((resolve, reject) => {
					uni.uploadFile({
						url: baseUrl.baseUrl + "rest/mgr/uploadFile",
						filePath: tempFilePath,
						name: 'file',
						formData: {
							'file': 'MultipartFile'
						},
						success: (uploadFileRes) => {
							resolve(JSON.parse(uploadFileRes.data))
						},
						fail:(err) => {
							reject(err)
						}
					});
				})
			},
			async createJsapiSignature() {
				// 根据接口返回config信息
				uni.request({
					url: baseUrl.baseUrl + "applicationUserRecord/jssignature",
					data: {
						url: window.location.href.split('#')[0]
					},
					method: 'GET',  
					header: {
						'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
					},
					success: (result) => {
						result = result.data.data
						console.log('result', this.$wx);
						this.$wx.config({
							debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，
										  //可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
							appId: result.appId, // 必填，公众号的唯一标识
							timestamp: result.timestamp, // 必填，生成签名的时间戳
							nonceStr: result.nonceStr, // 必填，生成签名的随机串
							signature: result.signature, // 必填，签名
							jsApiList: ['chooseImage', 'previewImage','uploadImage'], // 必填，需要使用的JS接口列表
						})
						this.$wx.ready(() => {
							// config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，
							// config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，
							// 则须把相关接口放在ready函数中调用来确保正确执行。
							// 对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中。
						})
						this.$wx.error(function (res1) {
							// config信息验证失败会执行error函数，如签名过期导致验证失败，具体错误信息可以打开config的debug模式查看，
							//也可以在返回的res参数中查看，对于SPA可以在这里更新签名。
						});	
					}
				})
			},
			handleDangerRadio(e,index){
				let val = e.detail.value;
				this.form.carInfo[index].isDanger = Number(val);
			},
			handleDangerRadio2(e,index){
				console.log(e,index);
				let val = e.detail.value;
				this.userForm.userInfo[index].isDanger = Number(val);
			},
			getOPenid(){
				
				if(this.openId){
					uni.setStorageSync('storage_key', this.openId);
					console.log(this.openId)
					this.getCARModel()
					this.getCampus()
					this.getCARType()
					this.getOrgan()
				} else{
					this.openId = uni.getStorageSync('storage_key');
					if(this.openId){
						this.getCARModel()
						this.getCampus()
						this.getCARType()
						this.getOrgan()
					}else{
						return 
						uni.setStorageSync('flag',1)
						window.location.href = "https://passport.ustc.edu.cn/login?service=http://bwclf.ustc.edu.cn/weixin/getOauthUrl";
					}
				}
			},
			getParam(path, name) {
				var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
				if (reg.test(path))
					return decodeURIComponent(RegExp.$2.replace(/\+/g, " "));
				return "";
			},
			getUserHistory(e, index) {
				if(this.disableInput) return ;
				if (index === 0) {
					console.log(index)
					var that = this
					uni.request({
						url: baseUrl.baseUrl + "applicationUserRecord/searchbykeywordandopenid",
						data: {
							openId:that.openId,
							type: 0,
							keyword: e.detail.value
						},
						method: 'POST',
						header: {
							'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
						},
						success(res) {
							if (res.data.code === 200) {
								if (res.data.data !== '') {
									that.campus = 'userForm'
									that.userForm = res.data.data
									that.userForm.concatGid = that.concatGid || that.userForm.concatGid
									that.userForm.concatName = that.concatName || that.userForm.concatName 
									that.userForm.concatWage = that.concatWage || that.userForm.concatWage
									that.userForm.checkUserName = that.userForm.checkUserName || null;
									that.userForm.checkUserGid = that.userForm.checkUserGid || null;
									that.userForm.checkUserEmail = that.userForm.checkUserEmail || null;
									var a = JSON.parse(res.data.data.userInfo)
									
									a.forEach(item => {
										for (var i = 0; i < that.carType.length; i++) {
											if (item.carType === that.carType[i].code) {
												item.carTypeName = that.carType[i].name
											}
											if(!item.isDanger) item.isDanger = 0;
										}
										if(item.applyArea===undefined){
											item.applyArea =''
										}
										if(item.areaId===undefined){
											item.areaId =''
										}
										item.akCode = ''
										item.tripCode = ''
										item.naCode = ''
										// item.passPlace = item.passPlace ? item.passPlace.split(',') : []
										// item.passPlaceName = item.passPlaceName? JSON.parse(item.passPlaceName) : []
										
									})
									that.userForm.userInfo = a
									that.defaultSelected = res.data.data.campusId.split(',')
									/* that.userIndex = res.data.data.enrolledHour|| 0 */
									that.userForm.enrolledDateTime = res.data.data.enrolledHour||'请输入具体时间'
									that.userFormDateRange = res.data.data.enrolledDate + '至' + res.data.data.endTime
									console.log(that.userForm)
								}
								that.getAuditPerson()
							}
						},
						fail(err) {
							console.log(err)
						}
					})
				}
			},
			getHistory(e,index) {
				if(this.disableInput) return ;
				if(index !== 0) return;
				var that = this
				uni.request({
					url: baseUrl.baseUrl + "applicationUserRecord/searchbykeywordandopenid",
					data: {
						openId:that.openId,
						type: 1,
						keyword: e.detail.value
					},
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
					},
					success(res) {
						if (res.data.code === 200) {
							if (res.data.data !== '') {
								that.campus=null
								that.form = res.data.data
								that.form.concatGid = that.concatGid || that.form.concatGid
								that.form.concatName = that.concatName || that.form.concatName
								that.form.concatWage = that.concatWage || that.form.concatWage
								that.form.checkUserName = that.form.checkUserName || null;
								that.form.checkUserGid = that.form.checkUserGid || null;
								that.form.checkUserEmail = that.form.checkUserEmail || null;
								if(!that.form.isDanger) that.form.isDanger = 0;
								var arr = JSON.parse(res.data.data.carInfo)
								arr.forEach(item => {
									console.log(that.CarModelList)
									for (var i = 0; i < that.CarModelList.length; i++) {
										if (item.carModel === that.CarModelList[i].code) {
											item.carModelName = that.CarModelList[i].name
											break;//如果找到了要跳出for循环
										}else{
											item.carModelName = '请选择车型';
										}	
									}
									item.akCode = ''
									item.tripCode = ''
									item.naCode = ''
									// item.passPlace = item.passPlace ? item.passPlace.split(',') : []
									
									// item.passPlaceName = item.passPlaceName? JSON.parse(item.passPlaceName) : []
									// 
								})
								that.form.carInfo = arr
								/* that.userIndex = res.data.data.enrolledHour ||0 */
								that.form.enrolledDateTime = res.data.data.enrolledHour ||'请输入具体时间'
								that.formDateRange = res.data.data.enrolledDate + '至' + res.data.data.endTime
								console.log(that.form)
							}
							that.getAuditPerson()
						}
					},
					fail(err) {
						console.log(err)
					}
				})
			},
			confirmXiaoqu(data) {
				if (this.campus) {
					this.userForm.campus = data.map((el) => el.label).join(" ");
					this.userForm.campusId = data.map((el) => el.value).join(",");
				} else {
					this.form.campus = data.map((el) => el.label).join(" ");
					this.form.campusId = data.map((el) => el.value).join(",");
				}
			},
			showPicker(type, index, name) {
				document.activeElement.blur();
				if (name) {
					this.name = name
				} else {
					this.name = null
				}
				console.log(index)
				if (index < 0) {
					this.numIndex = null
				} else {
					this.numIndex = index
				}
				this.modal = ''
				this.$refs[type].show();
			},
			onCancel(e){
				console.log(e)
			},
			onConfirmRegion(res, type) {
				if (this.numIndex > -1 && this.TabCur==1) {
					console.log(res.result)
					this.userForm.userInfo[this.numIndex].applyArea = res.result;
					let arr = []
					res.value.forEach(item => {
						arr.push(item)
					})
					this.userForm.userInfo[this.numIndex].areaId = arr.join(",");
				} else if(this.numIndex > -1 && this.TabCur==0) {
					let applyArea = res.result;
					let areaId = res.value.join(",");
					this.form.carInfo[this.numIndex].applyArea = applyArea;
					this.form.carInfo[this.numIndex].areaId = areaId;
				}
			},
			onConfirmPassRegion(res, type) {
				console.log('res', res);
				let areaId = res.value[2] || res.value[1];
				if (this.numIndex > -1 && this.TabCur==1) {
					this.userForm.userInfo[this.numIndex].passPlaceName.push({name: res.result, content: ''})
					this.userForm.userInfo[this.numIndex].passPlace.push(areaId)
				} else if(this.numIndex > -1 && this.TabCur==0) {
					this.form.carInfo[this.numIndex].passPlaceName.push({name: res.result, content: ''})
					this.form.carInfo[this.numIndex].passPlace.push(areaId)
				}
				console.log(this.form);
			},
			onConfirmLinkage(res, type) {
				if (this.name) {
					this.userForm.departName = res.obj.col2.departName
					let arr = []
					res.value.forEach(item => {
						arr.push(item)
					})
					this.userForm.deptId = arr[1];
				} else {
					let arr = []
					res.value.forEach(item => {
						arr.push(item)
					})
					this.form.departName = res.obj.col2.departName;
					this.form.deptId = arr[1];
				}
				this.userForm.checkUserName = null;
				this.userForm.checkUserGid = null;
				this.userForm.checkUserEmail = null;
				this.form.checkUserName = null;
				this.form.checkUserGid = null;
				this.form.checkUserEmail = null;
				this.getAuditPerson()
			},
			onConfirmAuditPerson(res, type) {
				console.log(res,this.name)
				if (this.name) {
					this.userForm.checkUserName = res.obj.checkUserName;
					this.userForm.checkUserGid = res.obj.checkUserGid;
					this.userForm.checkUserEmail = res.obj.checkUserEmail;
				} else {
					this.form.checkUserName = res.obj.checkUserName;
					this.form.checkUserGid = res.obj.checkUserGid;
					this.form.checkUserEmail = res.obj.checkUserEmail;
				}
				this.$forceUpdate() 
			},
		
			onConfirmUser(res, type) {
				console.log('-----------------------------------------------------------------------------')
				console.log(new Date(res.value.split('至')[0]).getTime())
				console.log(new Date(res.value.split('至')[1]).getTime())
				var startU = new Date(res.value.split('至')[0]).getTime()
				var endU = new Date(res.value.split('至')[1]).getTime()
				console.log(Math.floor(startU / (24 * 3600 * 1000)))
				console.log(Math.floor(endU / (24 * 3600 * 1000)))
				console.log(Math.floor(endU / (24 * 3600 * 1000)) - Math.floor(startU / (24 * 3600 * 1000)))
				if (Math.floor(endU / (24 * 3600 * 1000)) - Math.floor(startU / (24 * 3600 * 1000)) >= 7) {
					this.modal = 'DialogModal3'
				} else {
					this.userForm.enrolledDate = res.value.split('至')[0]
					this.userForm.endTime = res.value.split('至')[1]
					this.userFormDateRange = res.value;
				}

			},
			onConfirm(res, type) {
				console.log('-----------------------------------------------------------------------------')
				console.log(new Date(res.value.split('至')[0]).getTime())
				console.log(new Date(res.value.split('至')[1]).getTime())
				var start = new Date(res.value.split('至')[0]).getTime()
				var end = new Date(res.value.split('至')[1]).getTime()
				console.log(Math.floor(start / (24 * 3600 * 1000)))
				console.log(Math.floor(end / (24 * 3600 * 1000)))
				console.log(Math.floor(end / (24 * 3600 * 1000)) - Math.floor(start / (24 * 3600 * 1000)))
				if (Math.floor(end / (24 * 3600 * 1000)) - Math.floor(start / (24 * 3600 * 1000)) >= 7) {
					this.modal = 'DialogModal4'
				} else {
					this.form.enrolledDate = res.value.split('至')[0]
					this.form.endTime = res.value.split('至')[1]
					this.formDateRange = res.value;
				}
			},
			//查询
			search() {
				this.result = []
				if (this.keyword === '') {
					uni.showModal({
						title: '提示',
						content: '请输入入校申请人姓名进行查询',
						showCancel: false
					});
				} else {
					var that = this
					uni.request({
						url: baseUrl.baseUrl + "applicationUserRecord/searchresult",
						data: {
							keyword: that.Trim(that.keyword)
						},
						method: 'POST',
						header: {
							'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
						},
						success(res) {
							console.log(res)
							if (res.data.code === 200) {
								let lstCar = []
								res.data.data.lstCar.forEach(item => {
									if (item.applyType !== undefined) {
										lstCar.push(item)
									}
								})
								let lstUser = []
								res.data.data.lstUser.forEach(item => {
									if (item.applyType !== undefined) {
										lstUser.push(item)
									}
								})
								that.result = lstCar.concat(lstUser)
								if (!that.result.length) {
									uni.showModal({
										title: '提示',
										content: '当前查无此人',
										showCancel: false
									});
								}
							}
						},
						fail(err) {
							console.log(err)
						}
					})

				}
			},
			//获取证件类型
			getCARType() {
				console.log(baseUrl.baseUrl)
				var that = this
				uni.request({
					url: baseUrl.baseUrl + "rest/dict/getdictlist",
					data: {
						code: 'CardType'
					},
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
					},
					success(res) {
						that.carType = res.data.data
					},
					fail(err) {
						console.log(err)
					}
				})
			},
			//获取校外部门
			getOrgan() {
				var that = this
				uni.request({
					url: baseUrl.baseUrl + "rest/dept/getsysdeptlist",
					method: 'GET',
					header: {
						'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
					},
					success(res) {
						that.options = res.data.data
					},
					fail(err) {
						console.log(err)
					}
				})
			},
			getAuditPerson() {
				var that = this
				uni.request({
					url: baseUrl.baseUrl + "rest/dept/getOrgJobList",
					method: 'GET',
					header: {
						'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
					},
					data: {
						deptId: this.form.deptId || this.userForm.deptId
					},
					success(res) {
						console.log(res.data.data)
						that.auditPersons = null
						that.$nextTick(() => {
							that.auditPersons = res.data.data
						})
					},
					fail(err) {
						console.log(err)
					}
				})
			},
			//获取车型
			getCARModel() {
				var that = this
				uni.request({
					url: baseUrl.baseUrl + "rest/dict/getdictlist",
					data: {
						code: 'CarModel'
					},
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
					},
					success(res) {
						console.log(res.data)
						that.CarModelList = res.data.data
						console.log(that.CarModelList)
					},
					fail(err) {
						console.log(err)
					}
				})
			},
			//获取Campus
			getCampus() {
				var that = this
				uni.request({
					url: baseUrl.baseUrl + "rest/dict/getdictlist",
					data: {
						code: 'Campus'
					},
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
					},
					success(res) {
						let xiaoqu = []
						res.data.data.forEach(item => {
							var json = {
								label: item.name,
								value: item.code
							}
							xiaoqu.push(json)
						})
						that.xiaoqu = xiaoqu
					},
					fail(err) {
						console.log(err)
					}
				})
			},
			delCar(index) {
				this.modal = "DialogModal1"
				this.dialog = index
			},
			delUser(index) {
				console.log(index)
				this.modal = "DialogModal2"
				this.dialog = index
			},
			delU() {
				this.userForm.userInfo.splice(this.dialog, 1)
				this.modal = null
			},
			cancelU() {
				this.modal = null
			},
			del() {
				this.form.carInfo.splice(this.dialog, 1)
				this.modal = null
			},
			cancel() {
				this.modal = null
			},
			input(val) {
				this.form.carInfo[this.carIndex].carNumber = val
				console.log(val)
			},
			addCar() {
				var json = {
					userName:'',
					areaInfo: '',
					applyArea:'',
					areaId:'',
					isDanger: 0,
					userPhone:'',
					carNumber: '请输入车牌号',
					carModel: '',
					carModelName: '请选择车型',
					cabrand: '',
					akCode:'',
					tripCode:'',
					naCode:'',
					passPlace: [],
					passPlaceName: [],
				}
				this.form.carInfo.push(json)

			},
			addUser() {
				var json = {
					userName: '',
					userPhone: '',
					areaId: '',
					areaInfo: '',
					applyArea: '',
					carType: '',
					carTypeName: '请选择证件类型',
					cardNo: '',
					isDanger: 0,
					akCode:'',
					tripCode:'',
					naCode:'',
					passPlace: [],
					passPlaceName: [],
				}
				this.userForm.userInfo.push(json)

			},
			Trim(str){ 
			    return str.replace(/(^\s*)|(\s*$)/g, ""); 
			},
			submitusercarapply() {
				console.log(this.form);

				if(this.form.deptId.indexOf(',')!==-1){
					this.form.deptId=this.form.deptId.split(',')[1]
				}
				
				for (var i = 0; i < this.form.carInfo.length; i++) {
					let carInfo = this.form.carInfo[i];
					if (carInfo.userName === '') {
						uni.showModal({
							title: '提示',
							content: '请输入来访申请人',
							showCancel: false
						});
						return
					} 
					// else if (carInfo.akCode === '' || carInfo.akCode === undefined || !carInfo.akCode.length) {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '请选择上传安康码',
					// 		showCancel: false
					// 	});
					// 	return
					// }else if (carInfo.tripCode === '' || carInfo.tripCode === undefined || !carInfo.tripCode.length) {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '请选择上传行程码',
					// 		showCancel: false
					// 	});
					// 	return
					// } 
					// else if (carInfo.naCode === '' || carInfo.naCode === undefined || !carInfo.naCode.length) {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '请上传48小时核酸检测阴性报告',
					// 		showCancel: false
					// 	});
					// 	return
					// } 
					
					// else if (carInfo.areaId === '' || carInfo.areaId === undefined) {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '请选择申请人出发地',
					// 		showCancel: false
					// 	});
					// 	return
					// } 
					// else if (carInfo.passPlace === '' || carInfo.passPlace === undefined || carInfo.passPlace.length === 0) {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '请选择7天内到达或途径地点',
					// 		showCancel: false
					// 	});
					// 	return
					// } 
					// else if (carInfo.isDanger === '' || carInfo.isDanger=== undefined) {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '请选择是否有48小时核酸检测报告',
					// 		showCancel: false
					// 	});
					// 	return
					// } 
					else if (carInfo.userPhone === '') {
						uni.showModal({
							title: '提示',
							content: '请输入申请人电话',
							showCancel: false
						});
						return
					} 
					// else if (!this.$validate.isLicensePlate(carInfo.carNumber)) {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '请输入正确的车牌号',
					// 		showCancel: false
					// 	});
					// 	return
					// } 
					
					else if(carInfo.carModel==='') {
						return  uni.showModal({
									title: '提示',
									content: '请选择车型',
									showCancel: false
								});
					}
					
				}
				 
				if (this.form.deptId === '') {
					uni.showModal({
						title: '提示',
						content: '请选择校内接待部门',
						showCancel: false
					});
					return
				} else if (this.form.checkUserName === '' || this.form.checkUserName === null) {
					uni.showModal({
						title: '提示',
						content: '请输入审核人员',
						showCancel: false
					});
					return
				} else if (this.form.concatName === '') {
					uni.showModal({
						title: '提示',
						content: '请输入校内联系人',
						showCancel: false
					});
					return
				} else if (this.form.concatPhone === '') {
					uni.showModal({
						title: '提示',
						content: '请输入正确的校内联系人电话',
						showCancel: false
					});
					return
				}  else if (this.form.campusId === '' || this.form.campusId === 'undefined') {
					uni.showModal({
						title: '提示',
						content: '请选择校区',
						showCancel: false
					});
					return
				} else if (this.form.enrolledDate === '') {
					uni.showModal({
						title: '提示',
						content: '请选择入校日期',
						showCancel: false
					});
				} else if (this.form.enrolledReason === '') {
					uni.showModal({
						title: '提示',
						content: '请输入入校原因',
						showCancel: false
					});
				} else {
					console.log(this.form.carInfo)
					if (this.form.enrolledDateTime === '请输入具体时间') {
						this.form.enrolledDateTime = null
					}
					this.form.carInfo.forEach(item => {
						// item.akCode = item.akCode.toString()
						// item.tripCode = item.tripCode.toString()
						// item.naCode = item.naCode.toString()
						// item.passPlace = item.passPlace.toString()
						// item.areaInfo = ''
						// item.passPlaceName.forEach(item => item.content = '')
						// item.passPlaceName = JSON.stringify(item.passPlaceName)
						delete item.carModelName;
					})
					var that = this
					that.loadModal = true
					uni.request({
						url: baseUrl.baseUrl + "applicationCarRecord/usercarapply",
						data: {
							// userName: that.Trim(that.form.userName),
							// userPhone: that.Trim(that.form.userPhone),
							checkUserName: that.form.checkUserName,
							checkUserGid: that.form.checkUserGid,
							checkUserEmail: that.form.checkUserEmail,
							departName: that.form.departName,
							deptId: that.form.deptId,
							concatName: that.form.concatName,
							concatPhone: that.form.concatPhone,
							carInfo: JSON.stringify(that.form.carInfo),
							campus: that.form.campus,
							campusId: that.form.campusId,
							campusDoor: that.form.campusDoor,
							applyArea: that.form.applyArea,
							areaId: that.form.areaId,
							enrolledDate: that.form.enrolledDate,
							endTime: that.form.endTime,
							enrolledHour: that.form.enrolledDateTime,
							enrolledReason: that.form.enrolledReason,
							openId:that.openId,
							ticket:that.ticket,
							isDanger:  that.form.isDanger,
							concatGid: that.getParam(location.href, "concatGid") || that.form.concatGid,
							concatName: that.getParam(location.href, "concatName")|| that.form.concatName,
							concatWage: that.getParam(location.href, "concatWage")|| that.form.concatWage,
						},
						method: 'POST',
						header: {
							'content-type': 'application/json' //自定义请求头信息
						},
						success(res) {
							if (res.data.code === 200) {
								that.loadModal = false
								that.formDateRange = '年/月/日'
								that.xqindex = -1
								that.form = {
									checkUserName: '',
									checkUserGid: '',
									checkUserEmail: '',
									departName: '',
									applyArea: '',
									areaId: '',
									deptId: '',
									concatName: '',
									concatPhone: '',
									carInfo: [{
										userName:'',
										applyArea:'',
										areaId:'',
										isDanger: 0,
										userPhone:'',
										carNumber: '请输入车牌号',
										carModel: '',
										carModelName: '请选择车型',
										cabrand: '',
										akCode:'',
										tripCode:'',
										naCode:'',
										passPlace: [],
										passPlaceName: [],
									}],
									campus: '',
									campusId: '',
									campusDoor: '',
									enrolledDate: '',
									endTime: '',
									enrolledDateTime: '请输入具体时间',
									enrolledReason: ''
								}
								uni.showModal({
									content:'提交成功',
									showCancel:false,
									success: () => {
										setTimeout(()=>{
											uni.setStorageSync('flag',1)
											window.location.href=window.location.href
										},500)
									}
								})
							} else {
								console.log("--失败了-")
								uni.showModal({
									title: '提示',
									content: res.data.message,
									showCancel: false
								});
								that.loadModal = false
								if (!that.form.enrolledDateTime) {
									that.form.enrolledDateTime = '请输入具体时间'
								}
							}
						},
						fail(err) {
							console.log(err)
						}
					})
				}

			},
			submituserinfoapply() {
				console.log('submituserinfoapply', this.userForm);
				if(this.userForm.deptId.indexOf(',')!==-1){
					this.userForm.deptId=this.userForm.deptId.split(',')[1]
				}
				// if (this.userForm.userInfo[this.userForm.userInfo.length - 1].userName === '' ||
				// 	this.userForm.userInfo[this.userForm.userInfo.length - 1].akCode === '' ||
				// 	this.userForm.userInfo[this.userForm.userInfo.length - 1].tripCode === '' ||
				// 	this.userForm.userInfo[this.userForm.userInfo.length - 1].carType === '' ||
				// 	(this.userForm.userInfo[this.userForm.userInfo.length - 1].carType === 'CardType1' && !this.$validate.isIdCardNumber(this.userForm.userInfo[this.userForm.userInfo.length - 1].cardNo)) ||
				// 	this.userForm.userInfo[this.userForm.userInfo.length - 1].userPhone==='') {
				// 		alert()
					
				// } else
				for (var i in this.userForm.userInfo) {
					if (this.userForm.userInfo[i].userName === '') {
						uni.showModal({
							title: '提示',
							content: '请输入来访申请人',
							showCancel: false
						});
						return
					} 
					// else if (this.userForm.userInfo[i].akCode === '' || this.userForm.userInfo[i].akCode === 'undefined' || !this.userForm.userInfo[i].akCode.length) {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '请上传安康码',
					// 		showCancel: false
					// 	});
					// 	return
					// } else if (this.userForm.userInfo[i].tripCode === '' || this.userForm.userInfo[i].tripCode === 'undefined' || !this.userForm.userInfo[i].tripCode.length) {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '请上传行程码',
					// 		showCancel: false
					// 	});
					// 	return
					// } 
					// else if (this.userForm.userInfo[i].naCode === '' || this.userForm.userInfo[i].naCode === 'undefined' || !this.userForm.userInfo[i].naCode.length) {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '请上传48小时核酸检测阴性报告',
					// 		showCancel: false
					// 	});
					// 	return
					// } 
					
					// else if (this.userForm.userInfo[i].areaId === '' || this.userForm.userInfo[i].areaId === 'undefined') {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '请选择申请人出发地',
					// 		showCancel: false
					// 	});
					// 	return
					// }
					// else if (this.userForm.userInfo[i].passPlace === '' || this.userForm.userInfo[i].passPlace === 'undefined' || this.userForm.userInfo[i].passPlace.length === 0) {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '请选择7天内到达或途径地',
					// 		showCancel: false
					// 	});
					// 	return
					// } 
					// else if (this.userForm.userInfo[i].isDanger === '' || this.userForm.userInfo[i].isDanger=== undefined) {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '请选择是否有48小时核酸检测报告',
					// 		showCancel: false
					// 	});
					// 	return
					// } 
					else if (this.userForm.userInfo[i].carType === '') {
						uni.showModal({
							title: '提示',
							content: '请选择证件类型',
							showCancel: false
						});
						return
					} 
					// else if (this.userForm.userInfo[i].carType === 'CardType1' && !this.$validate.isIdCardNumber(this.userForm.userInfo[
					// 		i].cardNo)) {
					// 	uni.showModal({
					// 		title: '提示',
					// 		content: '请输入正确的身份证号码',
					// 		showCancel: false
					// 	});
					// 	return
					// } 
					else if (this.userForm.userInfo[i].userPhone==='') {
						uni.showModal({
							title: '提示',
							content: '请输入正确的来访申请人电话',
							showCancel: false
						});
						return
					}
				}
				 if (this.userForm.departName === '') {
					uni.showModal({
						title: '提示',
						content: '请输入校内接待部门名称',
						showCancel: false
					});
					return
				} else if (this.userForm.checkUserName === '' || this.userForm.checkUserName === null) {
					uni.showModal({
						title: '提示',
						content: '请输入校审核人员',
						showCancel: false
					});
					return
				} else if (this.userForm.concatName === '') {
					uni.showModal({
						title: '提示',
						content: '请输入校内联系人',
						showCancel: false
					});
					return
				} else if (this.userForm.concatPhone === '') {
					uni.showModal({
						title: '提示',
						content: '请输入正确的校内联系人电话',
						showCancel: false
					});
					return
				} else if (this.userForm.campusId === ''  || this.userForm.campusId === 'undefined') {
					uni.showModal({
						title: '提示',
						content: '请选择校区',
						showCancel: false
					});
					return
				} else if (this.userForm.enrolledDate === '') {
					uni.showModal({
						title: '提示',
						content: '请选择入校日期',
						showCancel: false
					});
					return
				} else if (this.userForm.enrolledReason === '') {
					uni.showModal({
						title: '提示',
						content: '请输入入校原因',
						showCancel: false
					});
					return
				} else {
					if (this.userForm.enrolledDateTime === '请输入具体时间') {
						this.userForm.enrolledDateTime = null
					}
					let arr = []
					let userinfo = JSON.parse(JSON.stringify(this.userForm.userInfo))
					userinfo.forEach(item => {
						// item.passPlaceName.forEach(item => item.content = '')
						let json = {
							userName: this.Trim(item.userName),
							userPhone: item.userPhone,
							areaId: item.areaId,
							applyArea: item.applyArea,
							carType: item.carType,
							cardNo: this.Trim(item.cardNo),
							isDanger: item.isDanger,
							// akCode: item.akCode.toString(),
							// tripCode: item.tripCode.toString(),
							// naCode: item.naCode.toString(),
							// passPlace: item.passPlace.toString(),
							// passPlaceName: JSON.stringify(item.passPlaceName)
						}
						arr.push(json)
					})
					var that = this
					that.loadModal = true
					uni.request({
						url: baseUrl.baseUrl + "applicationUserRecord/userinfoapply",
						data: {
							userInfo: JSON.stringify(arr),
							checkUserName: that.userForm.checkUserName,
							checkUserGid: that.userForm.checkUserGid,
							checkUserEmail: that.userForm.checkUserEmail,
							departName: that.userForm.departName,
							deptId: that.userForm.deptId,
							concatName: that.userForm.concatName,
							concatPhone: that.userForm.concatPhone,
							campus: that.userForm.campus,
							campusId: that.userForm.campusId,
							campusDoor: that.userForm.campusDoor,
							enrolledDate: that.userForm.enrolledDate,
							endTime: that.userForm.endTime,
							enrolledHour: that.userForm.enrolledDateTime,
							enrolledReason: that.userForm.enrolledReason,
							openId:that.openId,
							ticket:that.ticket,
							concatGid: that.getParam(location.href, "concatGid") || that.userForm.concatGid,
							concatName: that.getParam(location.href, "concatName") || that.userForm.concatName,
							concatWage: that.getParam(location.href, "concatWage") || that.userForm.concatWage
						},
						method: 'POST',
						header: {
							'content-type': 'application/json' //自定义请求头信息
						},
						success(res) {
							console.log(res)
							if (res.data.code === 200) {
								that.loadModal = false
							
								that.PXQindex = -1
								that.userFormDateRange = '年/月/日'
								that.userForm = {
									userInfo: [{
										userName: '',
										userPhone: '',
										areaId: '',
										applyArea: '',
										carType: '',
										carTypeName: '请选择身份类型',
										cardNo: '',
										akCode:'',
										tripCode:'',
										naCode:'',
										passPlace: [],
										passPlaceName: [],
									}],
									checkUserName: '',
									checkUserGid: '',
									departName: '',
									deptId: '',
									concatName: '',
									concatPhone: '',
									campus: '',
									campusId: '',
									campusDoor: '',
									enrolledDate: '',
									endTime: '',
									enrolledDateTime: '请输入具体时间',
									enrolledReason: ''
								}
								uni.pageScrollTo({
									scrollTop: 0,
									duration: 300
								});
								uni.showModal({
									content:'提交成功',
									showCancel:false,
									success: () => {
										setTimeout(()=>{
											window.location.href = window.location.href
										},500)
									}
								})
							} else {
								uni.showModal({
									title: '提示',
									content: res.data.message,
									showCancel: false
								});
								that.loadModal = false
								if (!that.userForm.enrolledDateTime) {
									that.userForm.enrolledDateTime = '请输入具体时间'
								}
							}
						},
						fail(err) {
							console.log(err)
						}
					})
				}
			},
			textareaBInput(e) {
				this.form.enrolledReason = e.detail.value
			},
			textareaBInputUser(e) {
				this.userForm.enrolledReason = e.detail.value
			},
			bindPickerNum(e) {
				console.log(parseInt(e.detail.value))
				this.form.enrolledDateTime = parseInt(e.detail.value)
				this.index = parseInt(e.detail.value)
			},
			bindPickerNumUser(e) {
				console.log(e)
				console.log(this.userForm.enrolledDateTime)
				this.userForm.enrolledDateTime = parseInt(e.detail.value)
				this.userIndex = parseInt(e.detail.value)
			},
			CarModelChange(e) {
				console.log(e)
				console.log(e.detail.value)
				this.carIndex = e.detail.value
				console.log(parseInt(e.currentTarget.dataset.id))
				console.log(this.CarModelList[this.carIndex].name)
				this.form.carInfo[parseInt(e.currentTarget.dataset.id)].carModel = this.CarModelList[this.carIndex].code
				this.form.carInfo[parseInt(e.currentTarget.dataset.id)].carModelName = this.CarModelList[this.carIndex].name
			},
			clear(e) {
				console.log(e)
			},
			bindType(e) {
				console.log(e)
				console.log(e.detail.value)
				this.typeindex = e.detail.value
				this.userForm.userInfo[parseInt(e.currentTarget.dataset.id)].carType = this.carType[this.typeindex].code
				this.userForm.userInfo[parseInt(e.currentTarget.dataset.id)].carTypeName = this.carType[this.typeindex].name
			},
			PickerSchool(val) {
				document.activeElement.blur();
				this.show = true
				this.campus = val === 'userForm' ? 'userForm' : null
				console.log(this.campus)
			},
			tabSelect(e) {
				this.TabCur = e.currentTarget.dataset.id;
				console.log(this.TabCur)
				uni.pageScrollTo({
					scrollTop: 0,
					duration: 300
				});
			},
			/**
			 * @desc 车牌选择关闭和打开
			 */
			showOrHide(flag) {
				console.log(this.plateNum)
				if (this.carIndex === 0) {
					let value = {
						detail: {
							value: this.plateNum
						}
					}
					// this.getHistory(value)
				}
				console.log("被关闭了吗")
				console.log(flag)
				this.plateNum = ''
			},
			/**
			 * @desc 显示车牌选择器
			 */
			carInputClick(index) {
				this.carIndex = index
				this.$refs.plate.show();
			},

		}
	}
</script>

<style lang="scss">
	.template-wrapper {
		padding-top: 30rpx;
		.btns {
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin: 0 20rpx 10rpx 20rpx;
			
			button {
				background: rgb(0, 122, 255);
				color: #FFFFFF;
				height: 70rpx;
				line-height: 70rpx;
				display: flex;
				align-items: center;
				.icon {
					width: 30rpx;
					height: 30rpx;
					margin-right: 10rpx;
				}
			}
		}
		.temp-tip {
			color: red;
			padding: 10rpx;
			
			.line {
				padding-left: 10rpx;
			}
		}
	}
	.can-click {
		font-weight: bold;
		color: #0081ff;
		text-decoration: underline;
		margin-left: 10rpx;
	}
	.img-picker{
		padding-left: 30rpx;
		padding-bottom: 10px;
		background: #FFFFFF;
	}
	.bordre-top {
		border-top: 2rpx solid #eee;
	}
	.modal {
		.mask {
			position: fixed;
			top: 0;
			left: 0;
			width: 100vw;
			height: 100vh;
			background-color: rgba(0,0,0,0.6);
			z-index: 99999;
		}
		.container {
			position: fixed;
			top: 15%;
			left: 50%;
			transform: translateX(-50%);
			width: 650rpx;
			height: 70vh;
			background: #fff;
			border-radius: 16px;
			display: flex;
			flex-direction: column;
			align-items: center;
			z-index: 99999;
			
			.title {
				line-height: 2.6;
				font-size: 36rpx;
				font-weight: 800;
			}
			.content {
				padding: 20rpx;
				flex: 1;
				overflow-y: scroll;
				view {
					padding: 10rpx 0;
				}
			}
			button {
				width: 300rpx;
				margin: 20rpx;
				&.active {
					background-color: #0081ff;
					color: #FFFFFF;
				}
			}
		}
	}
	.indextit {
		padding: 20rpx;
	}
	.cu-form-group {
		min-height:64px !important;
	}
	.cu-form-group .title {
		width: 240rpx;
	}

	.carnumber {
		width: 460rpx;
	}

	.carnumber image {
		width: 70rpx;
		height: 40rpx;
		vertical-align: middle;
		margin-left: 10rpx;
		color: #000000;
	}

	.cu-form-group uni-picker .picker {
		text-align: left;
	}

	.btn-add {
		text-align: center;
		background: white;
		height: 42px;
		line-height: 42px;
		border-top: 1rpx solid #eee;
	}

	.tips {
		color: #888;
		padding: 10px;
		font-size: 24rpx;
		background: white;
	}

	.tips view {
		margin-top: 10rpx;
		text-indent: 56rpx;
		text-align: justify;
	}

	.loadingfixed {
		width: 200rpx;
		height: 200rpx;
		display: block;
		position: fixed;
		top: 50%;
		left: 50%;
		margin-top: -100rpx;
		margin-left: -100rpx;
		line-height: 100px;
		background: rgba(0, 0, 0, 0.1);
		display: none;
	}
</style>
